<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib prefix="c" uri="/WEB-INF/tld/c.tld"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html>
<html>

<head>
<title>登录 &middot;</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<!-- Le styles -->
<link href="<%=path%>/bootstrap/css/bootstrap.css" rel="stylesheet">
<style type="text/css">
body {
	padding-top: 40px;
	padding-bottom: 40px;
	background-color: #f5f5f5;
}

.form-signin {
	max-width: 300px;
	padding: 19px 29px 29px;
	margin: 0 auto 20px;
	background-color: #fff;
	border: 1px solid #e5e5e5;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

.form-signin .form-signin-heading,.form-signin .checkbox {
	margin-bottom: 10px;
}

.form-signin input[type="text"],.form-signin input[type="password"] {
	font-size: 16px;
	height: auto;
	margin-bottom: 15px;
	padding: 7px 9px;
}
</style>
<link href="<%=path%>/bootstrap/css/bootstrap-responsive.css"
	rel="stylesheet">

<script src="<%=path%>/js/jquery.cookie.js" type="text/javascript"></script>
<script type="text/javascript" src="<%=path%>/js/jquery.min.js"></script>
<script type="text/javascript">
if(top!=this){
	top.location.href="<%=basePath%>/login.jsp";
}
</script>
</head>

<body background="<%=basePath %>css/images/bg/carbon_fibre_big.png">
	<c:if test="${!empty msg}">
		<div class="alert alert-danger alert-dismissable" style="text-align: center;">  
	      <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>  
	      <strong>提示!</strong>${msg }
	  	</div>
  	</c:if>
	<div class="container">
		<form name="frm" class="form-signin"
			action="<%=basePath %>user/login.do" method="post">
			<h2 class="form-signin-heading">登录</h2>
			<input name="userName" id="userName" value="${param.userName }" type="text" class="input-block-level"
				placeholder=""> 
			<input name="password" type="password" id="password"
				class="input-block-level" placeholder=""> <label
				class="checkbox"> 
			<input name="rmbUser" type="checkbox"
				value="rmbUser"> 记住我 </label>
			<button class="btn btn-large btn-primary" style="width: 100%" onclick="login()" data-loading-text="Loading..." type="button">登录</button>
		</form>
	</div>
	<!-- Placed at the end of the document so the pages load faster -->
	<script src="<%=path%>/bootstrap/js/bootstrap.min.js"></script>
	<script type="text/javascript">
		$(function (){
// 			var n=$.cookie("userName");			
// 			if(n!=null){
// 				$("#userName").val(n);
// 			}
		})
		function login(){
			var userName=$("#userName");
			var password=$("#password");
			if(jQuery.trim(userName.val())==''){
				alert("用户名不能为空")
				userName.focus();
				return;	
			}
			if(jQuery.trim(password.val())==''){
				alert("密码不能为空")
				password.focus().select();
				return;
			}
			var chk=$("#rememberme").attr("checked");
// 			if(chk=='checked' || chk){
// 				$.cookie("userName",userName);
// 			}else{
// 				$.cookie("userName",null);
// 			}
			//alert($.cookie("userName"))
			document.frm.submit();
		}
	</script>
</body>
</html>
